package com.qk.management.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qk.common.PageResult;
import com.qk.domain.operateLog.OperateLogDO;
import com.qk.dto.operateLog.OperateLogDTO;
import com.qk.entity.OperateLog;
import com.qk.management.mapper.OperateLogMapper;
import com.qk.management.service.OperateLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 日志业务实现类
 * @Author:Mr.m
 * @Date: 2025-10-20 14:19
 * @Description:
 */
@Slf4j
@Service
@SuppressWarnings("all")
public class OperateLogServiceImpl extends ServiceImpl<OperateLogMapper, OperateLog> implements OperateLogService {
    /**
     * 日志列表
     *
     * @param dto
     * @return
     */
    @Override
    public PageResult<OperateLogDO> logList(OperateLogDTO dto) {
        PageHelper.startPage(dto.getPage(),dto.getPageSize());
        List<OperateLogDO> list = this.baseMapper.selectByPage(dto);
        Page<OperateLogDO> page = (Page<OperateLogDO>) list;
        PageResult<OperateLogDO> result = PageResult.<OperateLogDO>builder()
                .total(Long.valueOf(page.getTotal()).intValue())
                .rows(page.getResult())
                .build();
        return result;
    }
}